Skip to content

fix(core): consolidate DOC_EXTENSIONS copies and add drift guard (#1489) - #2159

Merged
RaghavChamadiya merged 1 commit into
repowise-dev:mainfrom
rishu685:fix/1489-doc-extensions-drift-guard
Sep 11, 2026
Merged

fix(core): consolidate DOC_EXTENSIONS copies and add drift guard (#1489)#2159
RaghavChamadiya merged 1 commit into
repowise-dev:mainfrom
rishu685:fix/1489-doc-extensions-drift-guard

Conversation

@rishu685

@rishu685 rishu685 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Closes #1489

Context

Two hand-written literal copies of the documentation extension set ({".md", ".mdx", ".rst", ".txt", ".adoc"}) remained in categories.py and fix_shape.py, with no architectural test in place to prevent future drift.

Solution

  1. Consolidated Copies:
    • Pointed _DOC_SUFFIXES in packages/core/src/repowise/core/generation/categories.py to support_paths.DOC_EXTENSIONS.
    • Pointed _DOC_EXT in packages/core/src/repowise/core/ingestion/git_indexer/fix_shape.py to support_paths.DOC_EXTENSIONS.
  2. Added Drift Guard Test:
    • Created tests/unit/test_no_doc_extension_copies.py (following test_no_test_path_copies.py) to inspect the AST across packages/ and prevent new hand-written doc-extension sets or constants from being introduced outside repowise.core.support_paths.
    • Verified that categories._DOC_SUFFIXES, fix_shape._DOC_EXT, and knowledge_graph._DOC_EXTENSIONS all alias the exact same DOC_EXTENSIONS object.

Verification

pytest tests/unit/test_no_doc_extension_copies.py tests/unit/test_support_paths.py tests/unit/generation/test_categories.py tests/unit/ingestion/test_fix_shape.py
# 58 passed in 6.02s

ruff check packages/core/src/repowise/core/generation/categories.py packages/core/src/repowise/core/ingestion/git_indexer/fix_shape.py tests/unit/test_no_doc_extension_copies.py
# All checks passed!

…owise-dev#1489)

Closes repowise-dev#1489.

- Point _DOC_SUFFIXES in categories.py to DOC_EXTENSIONS from support_paths
- Point _DOC_EXT in fix_shape.py to DOC_EXTENSIONS from support_paths
- Add AST-based architectural drift guard test in tests/unit/test_no_doc_extension_copies.py
@rishu685 rishu685 changed the title ffix(core): consolidate DOC_EXTENSIONS copies and add drift guard (#1489) fix(core): consolidate DOC_EXTENSIONS copies and add drift guard (#1489) Sep 8, 2026

@RaghavChamadiya RaghavChamadiya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both replaced sets were byte-identical to the canonical one, so this is a pure dedup with no behaviour change, and the guard is the half that makes it stick. test_known_copies_still_exist is the detail I liked: an allowlist that cannot silently rot into a list of files that stopped being copies years ago.

@RaghavChamadiya
RaghavChamadiya merged commit b2056be into repowise-dev:main Sep 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two hand-written copies of DOC_EXTENSIONS remain, with no drift guard

2 participants